home *** CD-ROM | disk | FTP | other *** search
- JAFO #1 @8861
- Fri Dec 10 08:44:19 1993
- 0R: net33: @4076 (via @4061) [04:27 12/13/93]
- 0R: net33: @4050 (via @4064) [03:51 12/13/93]
- 0R: net33: @4064 (via @1040) [02:08 12/13/93]
- 0R: net33: @1040 (via @2050) [15:27 12/12/93]
- 0R: net34: @2050 [13:23 12/12/93]
- 0R: net34: @2050 (via @1040) [07:01 12/12/93]
- 0R: net33: @1040 (via @1) [08:12 12/12/93]
- 0R: net34: @1 (via @8856) [03:39 12/12/93]
- 0R: net33: @8856 (via @8861) [01:36 12/11/93]
- 0R: net33: @8861 [08:52 12/10/93]
- ┌────────────────────────────────────────────────────────────────────────────┐
- │ Mod Name : JAFO04G.MOD Mod Author: JAFO 1@1 TerraNET │
- │ Difficulty : █████▒▒▒▒▒ 1@8861 WWIVnet │
- │ WWIV Version : 4.23 1@8857 IceNET │
- │ Mod Date : 12/10/93 1@8857 SOLARnet │
- │ Files Affected: BBS.C, BBSUTL.C, COM.C, GFILES.C, 1@18857 WWIVLink │
- │ SHRINK.C, UTILITY.C, FCNS.H, VARS.H │
- │ Description : Enhanced Main Menu & Transfer Prompts │
- └────────────────────────────────────────────────────────────────────────────┘
-
- ══[ Description ]═════════════════════════════════════════════════════════════
-
- This mod will change the way your main menu and transfer prompts work.
- Normally, if you type '>', a few line spaces occur and the new prompt
- appears below. Here is an example:
-
- T - 50:33:21
- [1] [SysOp Announcements] :>
-
-
- T - 50:33:19
- [2] [General] :
-
- As you can see, if you wanted to go to sub #30, it could take up 5 screens
- to get there! This mod will keep the prompt on the SAME line while you
- advance or retreat subs, as well as directories, IF the user has ANSI
- enabled. If you have modified your prompts to include random quotes or
- something, and have more than 2 lines, I'd suggest not using this mod,
- because additional code will be required, and it will be very slow at 2400
- baud.
-
- Revision B Note: If you are using the original version of this mod,
- JAFO04, then I suggest you completely rip it out of
- your source and install this mod. This one is far
- easier to install too!
-
- Revision C Note: There was a very minor bug in 2.0. I forgot to add
- a single line in BBS.C so that while at WFC everything
- acts normally. If you installed V2.0, you probably
- noticed everything was kinda screwy at WFC.
-
- Revision D Note: This version of the mod now keeps the prompt on the same
- line when you press a valid sub/dir number. This was a
- feature of the original mod, but was taken out of
- subsequent versions (not by design). It has since been
- requested by many people, so it is in now.
-
- Revision E Note: Made a change suggested by Swamp Gas. If a user is in non-
- expert mode, prior versions would still reprint a menu when
- they changed subs. This version will keep the prompt on the
- same line. I've also fixed a few other problems with how
- prompts were handled for non-expert users.
-
- Revision F Note: This version works with WWIV v4.23. It is conference aware.
-
- Revision G Note: Added some minor changes to support the '{' and '}' keys for
- changing conferences. If you are upgrading from JAFO04F,
- only do steps 4 and 8.
-
- ══[ Legend ]══════════════════════════════════════════════════════════════════
-
- = Existing line - Do not change
- $ Existing line - Line has wrapped from previous line
- + Add this line
- - Remove this line
-
- ══[ Step 1 ]══════════════════════════════════════════════════════════════════
-
- Please back up your source code. Even the best programmers make mistakes.
-
- ══[ Step 2 ]══════════════════════════════════════════════════════════════════
-
- In VARS.H, change the line shown. You are adding the "newline" variable.
-
- = instance,debuglevel,multitasker,tagging,tagptr,cursormove,
- - titled;
- + titled, newline;
- =
- = __EXTRN__ unsigned short com_speed, *csn_index, crc, *gat, modem_flag,
- = modem_mode, modem_speed, net_sysnum, curloc;
-
- ══[ Step 3 ]══════════════════════════════════════════════════════════════════
-
- In BBS.C, add the the following line near the top.
-
- = #define _DEFINE_GLOBALS_
- = #include "vars.h"
- = #include "subxtr.h"
- =
- =
- = #include <math.h>
- + #include <ctype.h>
- =
- =
- = unsigned _stklen=15360;
-
- ══[ Step 4 ]══════════════════════════════════════════════════════════════════
-
- Put the following function right before "int checkpw".
-
- void prompt(char *s, char *s1, int useconf)
- {
- if ((okansi()) && (!newline)) {
- if (useconf)
- outstr("\r\x1b[2A");
- else
- outstr("\r\x1b[1A");
- } else
- nl();
- tleft(1);
- #ifdef OPT_EXTRA_COLOR
- npr("1T 0- 1%s\r\n",ctim(nsl()));
- #else
- npr("T - %s\r\n",ctim(nsl()));
- #endif
- if (useconf) {
- outstr(s);
- if ((okansi()) && (!newline))
- outstr("\x1b[K");
- nl();
- }
- prt(2,s1);
- if ((okansi()) && (!newline))
- outstr("\x1b[K");
- newline=0;
- }
-
- ══[ Step 5 ]══════════════════════════════════════════════════════════════════
-
- In "void mainmenu", make the changes shown.
-
- = void mainmenu(void)
- = {
- = char *s, s1[81], s2[81], ch;
- - int i, useconf, ac;
- + int i, i1, useconf, ac;
- = long l;
- =
- = s2[0]=0;
- = if (usub[cursub].subnum==-1) {
- = cursub=0;
- = if (usub[cursub].subnum==-1) {
- = strcpy(s2,get_string(16));
- = }
- = }
- =
- = write_inst(INST_LOC_MAIN,usub[cursub].subnum,INST_FLAGS_ONLINE);
- =
- = tleft(1);
- - if ((sysstatus_expert & thisuser.sysstatus)==0)
- + if ((newline) && ((sysstatus_expert & thisuser.sysstatus)==0))
- = printmenu(0);
- =
- - nl();
- - nl();
- = tleft(1);
- =
- = useconf=((subconfnum>1) && okconf(&thisuser));
- =
- = #ifdef OPT_EXTRA_COLOR
- - npr("1T 0- 1%s\r\n",ctim(nsl()));
- = sprintf(s1,"7[1Conf %c7] [1%s7]",
- $ subconfs[uconfsub[curconfsub].confnum].designator,
- = stripcolors(subconfs[uconfsub[curconfsub].confnum].name));
- = if (s2[0]==0)
- = sprintf(s2,"7[1%s%s7] [1%s7]0 : 2",
- = useconf?get_string(1398):"",
- = usub[cursub].keys,
- = stripcolors(subboards[usub[cursub].subnum].name));
- = #else
- - npr("T - %s\r\n",ctim(nsl()));
- = sprintf(s1,"[Conf %c] [%s]",
- $ subconfs[uconfsub[curconfsub].confnum].designator,
- = stripcolors(subconfs[uconfsub[curconfsub].confnum].name));
- = if (s2[0]==0)
- = sprintf(s2,"[%s%s] [%s] :",
- = useconf?get_string(1398):"",
- = usub[cursub].keys,
- = stripcolors(subboards[usub[cursub].subnum].name));
- = #endif
- =
- + prompt(s1,s2,useconf);
- +
- - if (useconf) {
- - ansic(2);
- - pl(s1);
- - }
- - prt(2,s2);
- = helpl=1;
- = s=mmkey(0);
- = helpl=0;
- - if (s[0])
- - for (i=0; (i<num_subs) && (usub[i].subnum!=-1); i++)
- - if (strcmp(usub[i].keys,s)==0)
- + if (s[0]) {
- + i1=0;
- + for (i=0; (i<num_subs) && (usub[i].subnum!=-1); i++) {
- + if (strcmp(usub[i].keys,s)==0) {
- = cursub=i;
- + i1=1;
- + }
- + }
- + if ((!i1) && (okansi()) && (isdigit(s[0]))) {
- + nl();
- + newline=1;
- + }
- + } else
- + newline=1;
- = if (strlen(s)>2) {
- = sprintf(s1,"//%s",s);
- = sysopchar(s1);
-
- ══[ Step 6 ]══════════════════════════════════════════════════════════════════
-
- In "void dlmainmenu", make the changes shown.
-
- = void dlmainmenu(void)
- = {
- = char *s, s1[81],s2[81],ch;
- = int i,i1,i2,abort,next,useconf,ac;
- = messagerec m;
- =
- = s2[0]=0;
- = if (udir[curdir].subnum==-1) {
- = curdir=0;
- = if (udir[curdir].subnum==-1) {
- = strcpy(s2,get_string(32));
- = }
- = }
- =
- = write_inst(INST_LOC_XFER,udir[curdir].subnum,INST_FLAGS_ONLINE);
- =
- = tleft(1);
- - if ((sysstatus_expert & thisuser.sysstatus)==0)
- + if ((newline) && ((sysstatus_expert & thisuser.sysstatus)==0))
- = printmenu(3);
- =
- - nl();
- - nl();
- = tleft(1);
- =
- = useconf=((dirconfnum>1) && okconf(&thisuser));
- =
- = #ifdef OPT_EXTRA_COLOR
- - npr("1T 0- 1%s\r\n",ctim(nsl()));
- = sprintf(s1,"7(1Conf %c7)0-7(1%s7)",
- $ dirconfs[uconfdir[curconfdir].confnum].designator,
- = stripcolors(dirconfs[uconfdir[curconfdir].confnum].name));
- = if (s2[0]==0)
- = sprintf(s2,"7(1%s%s7)0-7(1%s7)0 : 2",
- = useconf?get_string(1399):"",
- = udir[curdir].keys,
- = stripcolors(directories[udir[curdir].subnum].name));
- = #else
- - npr("T - %s\r\n",ctim(nsl()));
- = sprintf(s1,"(Conf %c)-(%s)",
- $ dirconfs[uconfdir[curconfdir].confnum].designator,
- = stripcolors(dirconfs[uconfdir[curconfdir].confnum].name));
- = if (s2[0]==0)
- = sprintf(s2,"(%s%s)-(%s) :",
- = useconf?get_string(1399):"",
- = udir[curdir].keys,
- = stripcolors(directories[udir[curdir].subnum].name));
- = #endif
- +
- + prompt(s1,s2,useconf);
- +
- - if (useconf) {
- - ansic(2);
- - pl(s1);
- - }
- - prt(2,s2);
- = helpl=2;
- = s=mmkey(1);
- = helpl=0;
- - if (s[0])
- - for (i=0; i<num_dirs; i++)
- - if (strcmp(udir[i].keys,s)==0)
- + if (s[0]) {
- + i1=0;
- + for (i=0; i<num_dirs; i++) {
- + if (strcmp(udir[i].keys,s)==0) {
- = curdir=i;
- + i1=1;
- + }
- + }
- + if ((!i1) && (okansi()) && (isdigit(s[0]))) {
- + nl();
- + newline=1;
- + }
- + } else
- + newline=1;
- = if (strlen(s)>2) {
- = sprintf(s1,"//%s",s);
- = sysopchar(s1);
-
- ══[ Step 7 ]══════════════════════════════════════════════════════════════════
-
- In BBSUTL.C, add the following line near the top.
-
- = #include "vars.h"
- + #include <ctype.h>
- =
- = #pragma hdrstop
-
- ══[ Step 8 ]══════════════════════════════════════════════════════════════════
-
- Replace the entire "char *mmkey" function with the one below.
-
- char *mmkey(int dl)
- {
- static unsigned char cmd1[10],cmd2[81],ch;
- int i,i1,expert,p,cp,useconf;
-
- if ((sysstatus_expert & thisuser.sysstatus)==0)
- expert=0;
- else
- expert=1;
- do {
- do {
- ch=getkey();
- } while ((((ch<' ') && (ch!=13)) || (ch>126)) && (hangup==0));
- ch=upcase(ch);
- outchr(ch);
- if (ch==13)
- cmd1[0]=0;
- else
- cmd1[0]=ch;
- cmd1[1]=0;
- p=0;
- switch(dl) {
-
- case 1:
- if (strchr(dtc,ch)!=NULL)
- p=2;
- else if (strchr(dcd,ch)!=NULL)
- p=1;
- break;
- case 2:
- if (strchr(odc,ch)!=NULL)
- p=1;
- break;
- case 0:
- if (strchr(tc,ch)!=NULL)
- p=2;
- else if (strchr(dc,ch)!=NULL)
- p=1;
- break;
- }
- if (p) {
- cp=1;
- do {
- do {
- ch=getkey();
- } while ((((ch<' ') && (ch!=13) && (ch!=8)) ||(ch>126))&&(hangup==0));
- ch=upcase(ch);
- if (ch==13) {
- if ((dl==2) || (!okansi()))
- nl();
- if ((!expert) && (!okansi()))
- newline=1;
- return(cmd1);
- } else {
- if (ch==8) {
- backspace();
- cmd1[--cp]=0;
- } else {
- cmd1[cp++]=ch;
- cmd1[cp]=0;
- outchr(ch);
- if ((ch=='/') && (cmd1[0]=='/')) {
- input(cmd2,50);
- if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
- (!newline)) {
- if (isdigit(cmd2[0])) {
- if ((curdloads==0) && (dl==0)) {
- i1=0;
- for (i=0; (i<num_subs) && (usub[i].subnum!=-1); i++)
- if (strcmp(usub[i].keys,cmd2)==0)
- i1=1;
- if (i1)
- nl();
- }
- if ((curdloads==1) && (dl==1)) {
- i1=0;
- for (i=0; i<num_dirs; i++)
- if (strcmp(udir[i].keys,cmd2)==0)
- i1=1;
- if (i1)
- nl();
- }
- if (dl==2)
- nl();
- } else
- nl();
- newline=1;
- }
- return(cmd2);
- } else if (cp==p+1) {
- if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
- (!newline)) {
- if (isdigit(cmd1[0])) {
- if ((dl==2) || (!okansi()))
- nl();
- if ((!expert) && (!okansi()))
- newline=1;
- } else {
- nl();
- newline=1;
- }
- } else {
- nl();
- newline=1;
- }
- return(cmd1);
- }
- }
- }
- } while (cp);
- } else {
- if (((curdloads!=0) && (curdloads!=1) && (dl!=2)) ||
- (!newline)) {
- switch (cmd1[0]) {
- case '>':
- case '+':
- case ']':
- case '}':
- case '<':
- case '-':
- case '[':
- case '{':
- case 'H':
- if ((dl==2) || (!okansi()))
- nl();
- if ((!expert) && (!okansi()))
- newline=1;
- break;
- default:
- if (isdigit(cmd1[0])) {
- if ((dl==2) || (!okansi()))
- nl();
- if ((!expert) && (!okansi()))
- newline=1;
- } else {
- nl();
- newline=1;
- }
- break;
- }
- } else {
- nl();
- newline=1;
- }
- return(cmd1);
- }
- } while (hangup==0);
- cmd1[0]=0;
- return(cmd1);
- }
-
- ══[ Step 9 ]══════════════════════════════════════════════════════════════════
-
- In COM.C, change the following line in "void input1".
-
- = case 13:
- = s[curpos] = 0;
- = done = echo = 1;
- - if (crend)
- + if ((newline) && (crend))
- = nl();
- = break;
-
- ══[ Step 10 ]═════════════════════════════════════════════════════════════════
-
- After "static void print_yn", add the following function.
-
- static void print_yn2(int i)
- {
- if (num_strings(i))
- outstr(getrandomstring(i));
- else switch(i) {
- case 2: outstr(str_yes); break;
- case 3: outstr(str_no); break;
- }
- }
-
- ══[ Step 11 ]═════════════════════════════════════════════════════════════════
-
- After "char ynq", add the following function.
-
- char ynq2(void)
- {
- char ch=0;
- ansic(1);
- while ((!hangup) &&
- ((ch = upcase(getkey())) != *str_yes) &&
- (ch != *str_no) &&
- (ch != *str_quit) &&
- (ch != 13))
- ;
- if (ch==*str_yes) {
- ch='Y';
- print_yn2(2);
- } else if (ch==*str_quit) {
- ch='Q';
- outstr(str_quit);
- } else {
- ch='N';
- print_yn2(3);
- }
- return(ch);
- }
-
- ══[ Step 12 ]═════════════════════════════════════════════════════════════════
-
- In GFILES.C, replace the following two functions.
-
- void hop_sub(void)
- {
- unsigned char s1[81], s2[81], ch;
- int c,i,i2,nc,abort=0,oc,os;
-
- nc=0;
- while (uconfsub[nc].confnum!=-1)
- nc++;
-
- if (okansi())
- outstr("\r\x1b[K");
- else
- nl();
- prt(2,get_string(1161));
- if (okansi())
- newline=0;
- input(s1,40);
- if (!s1[0])
- return;
- if (!okansi())
- nl();
-
- c=0; oc=curconfsub; os=usub[cursub].subnum;
-
- while ((c<nc) && (!abort)) {
- if (okconf(&thisuser))
- setuconf(CONF_SUBS,c,-1);
- i=0;
- while ((i<num_subs) && (usub[i].subnum!=-1) && (!abort)) {
- strcpy(s2,subboards[usub[i].subnum].name);
- for (i2=0;(s2[i2]=upcase(s2[i2]))!=0;i2++)
- ;
- if (strstr(s2,s1)!=NULL) {
- if (okansi())
- outstr("\r\x1b[K");
- if (!okansi())
- nl();
- ansic(5);
- npr("%s\"%s\"",get_string(1162),subboards[usub[i].subnum].name);
- npr(get_string(1378));
- ch=ynq2();
- if (ch=='Y') {
- abort=1;
- cursub=i;
- break;
- } else if (ch=='Q') {
- abort=1;
- if (okconf(&thisuser))
- setuconf(CONF_SUBS, oc, os);
- break;
- }
- }
- ++i;
- }
- c++;
- if (!okconf(&thisuser))
- break;
- }
- if ((okconf(&thisuser)) && (!abort))
- setuconf(CONF_SUBS, oc, os);
- }
-
-
- void hop_dir(void)
- {
- unsigned char s1[81],s2[81],ch;
- int c,i,i2,nc,abort=0,oc,os;
-
- nc=0;
- while (uconfdir[nc].confnum!=-1)
- nc++;
-
- if (okansi())
- outstr("\r\x1b[K");
- else
- nl();
- prt(2,get_string(1163));
- if (okansi())
- newline=0;
- input(s1,40);
- if (!s1[0])
- return;
- if (!okansi())
- nl();
-
- c=0; oc=curconfdir; os=udir[curdir].subnum;
-
- while ((c<nc) && (!abort)) {
- if (okconf(&thisuser))
- setuconf(CONF_DIRS,c,-1);
- i=0;
- while ((i<num_dirs) && (udir[i].subnum!=-1) && (!abort)) {
- strcpy(s2,directories[udir[i].subnum].name);
- for (i2=0;(s2[i2]=upcase(s2[i2]))!=0;i2++)
- ;
- if (strstr(s2,s1)!=NULL) {
- if (okansi())
- outstr("\r\x1b[K");
- if (!okansi())
- nl();
- ansic(5);
- npr("%s\"%s\"",get_string(1162),directories[udir[i].subnum].name);
- npr(get_string(1378));
- ch=ynq2();
- if (ch=='Y') {
- abort=1;
- curdir=i;
- break;
- } else if (ch=='Q') {
- abort=1;
- if (okconf(&thisuser))
- setuconf(CONF_DIRS, oc, os);
- break;
- }
- }
- ++i;
- }
- c++;
- if (!okconf(&thisuser))
- break;
- }
- if ((okconf(&thisuser)) && (!abort))
- setuconf(CONF_DIRS, oc, os);
- }
-
- ══[ Step 13 ]═════════════════════════════════════════════════════════════════
-
- In SHRINK.C, add the following line to "int restore_data".
-
- = READ(numbatch);
- = READ(numbatchdl);
- + READ(newline);
- =
- = sh_read(f,batch, numbatch*sizeof(batchrec));
-
- ══[ Step 14 ]═════════════════════════════════════════════════════════════════
-
- Add the following line in "void save_state".
-
- = WRITE(numbatch);
- = WRITE(numbatchdl);
- + WRITE(newline);
- =
- = sh_write(f,batch, numbatch*sizeof(batchrec));
-
- ══[ Step 15 ]═════════════════════════════════════════════════════════════════
-
- In UTILITY.C, add the following line to "void frequent_init".
-
- = void frequent_init(void)
- = /* This should be called after a user is logged off, and will initialize
- = * screen-access variables.
- = */
- = {
- = setiia(90);
- = g_flags=0;
- = in_fsed=0;
- = tagging=0;
- + newline=1;
- = curlsub=-1;
- = curldir=-1;
-
- ══[ Step 16 ]═════════════════════════════════════════════════════════════════
-
- In FCNS.H, add the following lines.
-
- = int yn(void);
- = int ny(void);
- = char ynq(void);
- + char ynq2(void);
- = void ansic(int n);
- = void ansic_x(int n);
-
- ══[ Step 17 ]═════════════════════════════════════════════════════════════════
-
- Compile your source. Since we added a variable to VARS.H, a full re-compile
- is necessary.
-
- ══[ Disclaimer ]══════════════════════════════════════════════════════════════
-
- Don't complain to me if your board gets fried, your hard disk goes nuts, or
- something terrible happens. The code in this mod should be harmless, but I
- can't guarantee it will work for you. It works on my board.
-
- JAFO 1@1 TerraNET
- 1@8861 WWIVnet
- 1@8857 IceNET
- 1@8857 SOLARnet
- 1@18857 WWIVLink